<?php

namespace app\admin\controller;

use think\Controller;
use app\admin\server\AccessToken;
class Moban extends Controller
{
    protected $token='';
    public function __construct()
    {
        $AccessToken=new AccessToken();
        $token=$AccessToken::getAccessToken();
        $this->token=$token;
    }
    public function setIndustry()
    {
        $url='https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token='.$this->token;
        $data='{"industry_id1":"1","industry_id2":"2"}';
        $res=http_curl($url,$data,'POST');
        return json($res);
    }

    public function getIndustry()
    {
        $url='https://api.weixin.qq.com/cgi-bin/template/get_industry?access_token='.$this->token;
        $res=http_curl($url);
        return json($res);
    }

    public function getModelId()
    {
        $url='https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token='.$this->token;
        $data='{"template_id_short":"TM00015"}';
        $res=http_curl($url,$data,'POST');
        return json($res);
    }

    public function getModelList()
    {
        $url='https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token='.$this->token;
        $res=http_curl($url);
        return json($res);
    }
}
